﻿// Prototype extensions

Array.prototype.ToJson = function() {
    ///	<summary>
    ///		Convert an array to json format and return it.
    ///	</summary>
    return Sys.Serialization.JavaScriptSerializer.serialize(this);
};

Array.prototype.clear = function(arr) {
    ///	<summary>
    ///		Clears down the passed array.
    ///	</summary>
    ///	<param name="arr" type="Array">The array to clear.</param>
    arr = arr || this;
    arr.length = 0;
};

Array.prototype.clone = function(arr) {
    ///	<summary>
    ///		Clones the passed array.
    ///	</summary>
    ///	<param name="arr" type="Array">The array to clone.</param>
    ///	<returns type="Array">The clone array.</returns>
    arr = arr || this;
    return arr.concat();
};